package com.dmzc.addon;

public final class Tutle implements Comparable {
    //存储勾股数
    private int rightSideA;
    private int rightSideB;
    private int hypotenuse;

    public Tutle(int rightSideA, int rightSideB, int hypotenuse) {
        this.rightSideA = rightSideA;
        this.rightSideB = rightSideB;
        this.hypotenuse = hypotenuse;
    }

    private Tutle() {

    }

    public int getRightSideA() {
        return rightSideA;
    }

    public int getRightSideB() {
        return rightSideB;
    }

    public int getHypotenuse() {
        return hypotenuse;
    }

    @Override
    public String toString() {
        return rightSideA +
                " " + rightSideB +
                " " + hypotenuse;
    }

    @Override
    public int compareTo(Object o) {
        Tutle tutle = (Tutle) o;
        if (this.rightSideA == tutle.rightSideA) {
            if (this.rightSideB == tutle.rightSideB) {
                if (this.hypotenuse == tutle.hypotenuse) {
                    return 0;
                } else {
                    return this.hypotenuse - tutle.hypotenuse;
                }
            } else {
                return this.rightSideB - tutle.rightSideB;
            }
        } else {
            return this.rightSideA - tutle.rightSideA;
        }
    }
}
